package com.softcomputer.rpt.ejbclient;

import com.softcomputer.rpt.generated.GeneratedExCourse;
import com.softcomputer.rpt.generated.ObjectFactory;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;

public class App {

    public static void main(String[] args) throws MalformedURLException, JAXBException {

        URL url = new URL("http://IPSedin:8080/WebServiceBeanService/WebServiceBean?wsdl");
        QName serviceName = new QName(
                "http://ejb.rpt.softcomputer.com/",
                "WebServiceBeanService");
        QName portName = new QName(
                "http://ejb.rpt.softcomputer.com/",
                "WebServiceBeanPort");

        Service service = Service.create(url, serviceName);

        Echo ejbService = service.getPort(portName, Echo.class);

        System.out.println("\n" + ejbService.echo("hkjhj"));

        ObjectFactory objectFactory = new ObjectFactory();
        GeneratedExCourse newCourse = objectFactory.createGeneratedExCourse();
        newCourse.setId(4);
        newCourse.setCurrency("USD");
        newCourse.setIndollars(1);

        System.out.println(ejbService.processExCourse(newCourse));
    }
}
